package cn.edu.baiyunu.myapplication.data.model

import cn.edu.baiyunu.myapplication.R

/**
 * 照片规格数据提供者
 */
object PhotoSpecProvider {
    
    /**
     * 获取所有支持的规格
     */
    fun getAllSpecs(): List<PhotoSpec> {
        return listOf(
            // 国内常用证件照规格
            PhotoSpec(
                id = "one_inch",
                name = "一寸照",
                category = "国内证件照",
                width = 25f,
                height = 35f,
                description = "25×35mm"
            ),
            PhotoSpec(
                id = "two_inch",
                name = "二寸照",
                category = "国内证件照",
                width = 35f,
                height = 49f,
                description = "35×49mm"
            ),
            PhotoSpec(
                id = "small_two_inch",
                name = "小二寸",
                category = "国内证件照",
                width = 35f,
                height = 45f,
                description = "35×45mm"
            ),
            PhotoSpec(
                id = "small_one_inch",
                name = "小一寸",
                category = "国内证件照",
                width = 22f,
                height = 32f,
                description = "22×32mm"
            ),
            PhotoSpec(
                id = "large_one_inch",
                name = "大一寸",
                category = "国内证件照",
                width = 33f,
                height = 48f,
                description = "33×48mm"
            ),
            PhotoSpec(
                id = "id_card",
                name = "身份证照",
                category = "国内证件照",
                width = 26f,
                height = 32f,
                description = "26×32mm"
            ),
            PhotoSpec(
                id = "driving_license",
                name = "驾驶证照",
                category = "国内证件照",
                width = 22f,
                height = 32f,
                description = "22×32mm"
            ),
            PhotoSpec(
                id = "work_permit",
                name = "工作证照",
                category = "国内证件照",
                width = 26f,
                height = 32f,
                description = "26×32mm"
            ),
            PhotoSpec(
                id = "residence_permit",
                name = "居住证照",
                category = "国内证件照",
                width = 26f,
                height = 32f,
                description = "26×32mm"
            ),
            PhotoSpec(
                id = "student_id",
                name = "学生证照",
                category = "国内证件照",
                width = 26f,
                height = 32f,
                description = "26×32mm"
            ),
            PhotoSpec(
                id = "graduation",
                name = "毕业照",
                category = "国内证件照",
                width = 35f,
                height = 53f,
                description = "35×53mm"
            ),
            
            // 国际证件照规格
            PhotoSpec(
                id = "passport",
                name = "护照照",
                category = "国际证件照",
                width = 33f,
                height = 48f,
                description = "33×48mm"
            ),
            PhotoSpec(
                id = "visa",
                name = "签证照",
                category = "国际证件照",
                width = 35f,
                height = 45f,
                description = "35×45mm"
            ),
            PhotoSpec(
                id = "us_visa",
                name = "美国签证照",
                category = "国际证件照",
                width = 51f,
                height = 51f,
                description = "51×51mm(2×2英寸)"
            ),
            PhotoSpec(
                id = "uk_visa",
                name = "英国签证照",
                category = "国际证件照",
                width = 35f,
                height = 45f,
                description = "35×45mm"
            ),
            PhotoSpec(
                id = "schengen_visa",
                name = "申根签证照",
                category = "国际证件照",
                width = 35f,
                height = 45f,
                description = "35×45mm"
            ),
            PhotoSpec(
                id = "japan_visa",
                name = "日本签证照",
                category = "国际证件照",
                width = 45f,
                height = 45f,
                description = "45×45mm"
            ),
            PhotoSpec(
                id = "australia_visa",
                name = "澳大利亚签证照",
                category = "国际证件照",
                width = 35f,
                height = 45f,
                description = "35×45mm"
            ),
            PhotoSpec(
                id = "canada_visa",
                name = "加拿大签证照",
                category = "国际证件照",
                width = 35f,
                height = 45f,
                description = "35×45mm"
            ),
            
            // 添加一些常用的其他证件照规格
            PhotoSpec(
                id = "hukou_photo",
                name = "户口本照片",
                category = "国内证件照",
                width = 33f,
                height = 48f,
                description = "33×48mm"
            ),
            PhotoSpec(
                id = "social_security",
                name = "社保卡照片",
                category = "国内证件照",
                width = 26f,
                height = 32f,
                description = "26×32mm"
            ),
            
            // 社交媒体照片规格
            PhotoSpec(
                id = "linkedin",
                name = "领英照片",
                category = "社交媒体",
                width = 400f,
                height = 400f,
                description = "400×400像素"
            ),
            PhotoSpec(
                id = "wechat",
                name = "微信头像",
                category = "社交媒体",
                width = 200f,
                height = 200f,
                description = "200×200像素"
            ),
            PhotoSpec(
                id = "qq",
                name = "QQ头像",
                category = "社交媒体",
                width = 100f,
                height = 100f,
                description = "100×100像素"
            ),
            
            // 求职简历照片规格
            PhotoSpec(
                id = "resume_photo",
                name = "简历照片",
                category = "求职简历照",
                width = 35f,
                height = 45f,
                description = "35×45mm"
            ),
            PhotoSpec(
                id = "resume_eu",
                name = "欧盟简历照",
                category = "求职简历照",
                width = 35f,
                height = 45f,
                description = "35×45mm"
            ),
            PhotoSpec(
                id = "resume_us",
                name = "美国简历照",
                category = "求职简历照",
                width = 51f,
                height = 51f,
                description = "51×51mm"
            )
        )
    }
    
    /**
     * 获取热门规格
     */
    fun getPopularSpecs(limit: Int = 6): List<PhotoSpec> {
        // 返回最常用的几种规格
        val popularIds = listOf(
            "one_inch", "two_inch", "small_one_inch", 
            "passport", "id_card", "visa"
        )
        
        // 按照上面定义的顺序获取热门规格
        val specs = getAllSpecs()
        return popularIds.mapNotNull { id ->
            specs.find { it.id == id }
        }.take(limit)
    }
    
    /**
     * 根据ID获取规格
     */
    fun getSpecById(id: String): PhotoSpec? {
        return getAllSpecs().find { it.id == id }
    }
    
    /**
     * 根据名称获取规格
     */
    fun getSpecByName(name: String): PhotoSpec? {
        return getAllSpecs().find { it.name == name }
    }
} 